package com.cloud.api.domain.tsp;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.cloud.core.entity.base.BaseEntity ;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * 
 * </p>
 *
 * @author haohaibo
 * @since 2023-12-20
 */
@Getter
@Setter
@Accessors(chain = true)
@TableName("t_vehicle_sale")
@Schema(name = "VehicleSale", description = "销售数据")
public class VehicleSale extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId("id")
    private String id;

    @TableField("vin")
    @NotEmpty(message = "{validation.Information.vin}")
    @Size(max = 17,min = 17,message = "{validation.Information.vinSize}")
    private String vin;

    @Schema(description = "品牌")
    @TableField("model_brand")
    private String modelBrand;

    @Schema(description = "车系")
    @TableField("model_series")
    private String modelSeries;

    @Schema(description = "车型")
    @TableField("model_type")
    private String modelType;

    @Schema(description = "车辆类型：油车电车")
    @TableField("vehicle_type")
    private String vehicleType;

    @Schema(description = "组织机构id")
    @TableField("dept_id")
    @NotEmpty(message = "{validation.Information.dept}")
    private String deptId;

    @Schema(description = "销售日期")
    @TableField("sale_date")
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @NotNull(message = "{validation.production.saleDate}")
    private Date saleDate;

    @Schema(description = "车主姓名")
    @TableField("car_owner")
    @NotEmpty(message = "{validation.owner.owner}")
    @Size(max = 10,message = "{validation.common.maxSize}")
    private String carOwner;

    @Schema(description = "车牌号")
    @TableField("license_number")
//    @NotEmpty(message = "{validation.sale.licenseNumber}")
    @Size(max = 8,min = 7,message = "{validation.common.size}")
    private String licenseNumber;

    @Schema(description = "车主电话")
    @TableField("phone_number")
    @NotEmpty(message = "{validation.common.phone}")
    @Pattern(regexp = "^(13[0-9]|14[01456879]|15[0-35-9]|16[2567]|17[0-8]|18[0-9]|19[0-35-9])\\d{8}$",message = "手机号码格式错误")
    private String phoneNumber;

    @Schema(description = "版本名称",hidden = true)
    @TableField(exist = false)
    private String modelName;

    @Schema(description = "组织机构名称",hidden = true)
    @TableField(exist = false)
    private String deptName;

    @Schema(description = "省")
    @TableField("province")
    private String province;

    @Schema(description = "市")
    @TableField("city")
    private String city;

    @Schema(description = "区")
    @TableField("district")
    private String district;

    @Schema(description = "设备编号")
    @TableField("did")
    private String did;

    @Schema(description = "销售数量",hidden = true)
    @TableField(exist = false)
    private Integer saleCount;
}